﻿
Imports Microsoft.Reporting.WebForms
Imports Control.clases
Public Class ReporteLugarUbicacion
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim obj As New clsUbicacionLugar
        Dim dt As DataTable
        With DropDownList1
            dt = obj.listarLugar
            .DataSource = dt
            .DataValueField = "id_lugar"
            .DataTextField = "lugar_sede"
            .DataBind()
        End With
        With DropDownList2
            dt = obj.listarUbicacion
            .DataSource = dt
            .DataValueField = "id_ubicacion"
            .DataTextField = "ubicacion_area"
            .DataBind()
        End With
    End Sub

    Private Sub principal(ByVal lugar As String, ByVal ubicacion As String)
        Me.ReportViewer1.LocalReport.ReportPath = ("reportes\ReporteLugarUbicacion.rdlc")
        Me.ReportViewer1.LocalReport.DataSources.Clear()

        Dim adapter As New DataSetTableAdapters.usp_consulta_equipos_lugar_ubicacionTableAdapter
        Dim table As New DataSet.usp_consulta_equipos_lugar_ubicacionDataTable

        'adapter.FillTb_Equipo(table, strIP, strMAC, strNombre)
        'adapter.FillTb_Equipo(table, strIP, strMAC)
        adapter.Fill(table, Integer.Parse(lugar), Integer.Parse(ubicacion))

        Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("DataSet1", CType(table, DataTable)))
        Me.ReportViewer1.DataBind()
    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        principal(Me.DropDownList1.SelectedValue, Me.DropDownList2.SelectedValue)
    End Sub
End Class